#include <iostream>
#include <string>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
int main()
{
if (fork() == 0)
{
sleep(1);
int a = 10;
a /= 0;
exit(0);
} 
int status = 0;
waitpid(-1, &status, 0);
printf("exit signal: %d, core dump: %d\n", status&0x7F, (status>>7)&1);
return 0;
}